package com.mtsmda.util;

import java.lang.reflect.Field;

import com.mtsmda.Person;

public class PersonUtil {

	public static String[] getFieldNamesInPerson() {
		String[] fieldNamePerson = null;

		Class<Person> personClass = Person.class;
		Field[] declaredFields = personClass.getDeclaredFields();
		fieldNamePerson = new String[declaredFields.length];
		for (int i = 0; i < declaredFields.length; i++) {
			Field currentField = declaredFields[i];
			if (currentField != null) {
				fieldNamePerson[i] = currentField.getName();
			}
		}

		return fieldNamePerson;
	}

	public static void main(String[] args) {
		String[] fieldNamesInPerson = getFieldNamesInPerson();
		for(String s : fieldNamesInPerson){
			System.out.println(s);
		}
	}

}